<template>
  <view class="clock-tip bg-white h-[100vh]">
    <view
      class="content px-7 box-border flex flex-col justify-center items-center w-[100%]"
      v-if="isSuccess != -1"
    >
      <template v-if="isSuccess === 1">
        <up-icon name="checkmark-circle" color="#6BC839" size="97"></up-icon>
        <view class="text-black flex flex-col items-center mt-16 text-center">
          <text class="text-[33rpx]">打卡成功</text>
          <text class="text-[29rpx] mt-3">2秒后将自动跳转到在线答题页面</text>
        </view>
      </template>
      <template v-if="isSuccess === 0">
        <up-icon name="close-circle-fill" color="#E84335" size="97"></up-icon>
        <view class="text-black flex flex-col items-center mt-16 text-center">
          <text class="text-[33rpx]">打卡失败</text>
          <text class="text-[29rpx] mt-3"
            >您目前的打卡位置不在社区警务室，请在规定地点扫码打卡</text
          >
        </view>
      </template>
    </view>
  </view>
</template>
<script setup lang="ts">
const isSuccess = ref(-1);
const timer = <any>ref(null);
onLoad((options) => {
  if (options) {
    isSuccess.value = +options.status;
    if (+options.status === 1) {
      if (timer) clearTimeout(timer);
      timer.value = setTimeout(() => {
        uni.navigateTo({
          url: "/subPages/police/onlineAnswer/onlineAnswer",
        });
        clearTimeout(timer);
      }, 2000);
    }
  }
});
</script>
<style lang="scss" scoped>
.clock-tip {
  position: relative;
  .content {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translate(-50%, -25%);
  }
}
</style>
